package com.ultrawise.survey.module.surevybase.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ultrawise.survey.core.base.BaseService;
import com.ultrawise.survey.module.surevybase.dao.TSurveyInfoQuestionDAO;
import com.ultrawise.survey.module.surevybase.vo.TSurveyInfoQuestion;

@Service("tSurveyInfoQuestionService")
public class TSurveyInfoQuestionService extends BaseService {

	@Autowired
	TSurveyInfoQuestionDAO tSurveyInfoQuestionDAO;

	/****
	 * 查询出根据问卷id返回问题信息
	 * 
	 * @param syid
	 * @return
	 */
	public List<TSurveyInfoQuestion> getQuestionBysyid(Integer syid) {
		return tSurveyInfoQuestionDAO.getQuestionBysyid(syid);
	}
	
	//问题表（对qn_options的答题进行分割）
	public List<Map<String,Object>> getOptionsNumBySyid(String syid){
		String sql="select char_length(qn_options)-char_length(replace(qn_options,'|',''))+1 as OPTIONNUM,id as QN_ID  from t_survey_info_question where QN_TYPE<>5 AND sy_id="+syid;
		return tSurveyInfoQuestionDAO.queryBysql(sql);
	}
	
}